take lock in checkLogFile and calcLogFile
authorJoey Hess <joeyh@joeyh.name>
Fri, 7 Oct 2022 17:19:17 +0000 (13:19 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 7 Oct 2022 17:19:17 +0000 (13:19 -0400)
commit4a42c69092a03cce7b31b79b862e59c9842ced77
tree175af63aa3aa0cbdaa71848ad25cc6b732fae61d
parent85dbc21c1c4d1f311f70ae7f13b0624aefa71ad4
take lock in checkLogFile and calcLogFile

move: Fix openFile crash with -J

This does make them a bit slower, although usually the log file is not
very big, so even when it's being rewritten, they will not block for
long taking the lock. Still, little slowdowns may add up when moving a lot
file files.

A less expensive fix would be to use something lower level than openFile
that does not check if the file is already open for write by another
thread. But GHC does not seem to provide anything convenient; even mkFD
checks for a writing thread.

fullLines is no longer necessary since these functions no longer will
read the file while it's being written.

Sponsored-by: Dartmouth College's DANDI project
CHANGELOG
Command/Move.hs
Logs/File.hs
Logs/Restage.hs
doc/bugs/move.log__58___openFile__58___resource_busy___40__file_is_locked__41__.mdwn
doc/bugs/move.log__58___openFile__58___resource_busy___40__file_is_locked__41__/comment_1_14d5ba72397406620ac0a9fb05f2862d._comment [new file with mode: 0644]